package com.amigo.online.provider.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amigo.online.provider.manager.mapper.MerchantEnvironmentMapper;
import com.amigo.online.provider.manager.model.entity.MerchantEnvironment;
import com.amigo.online.provider.manager.service.MerchantEnvironmentService;

@Service
public class MerchantEnvironmentServiceImpl implements MerchantEnvironmentService {

    @Resource
    private MerchantEnvironmentMapper merchantEnvironmentMapper;

    @Override
    public boolean saveMerchantEnvironment(MerchantEnvironment merchantEnvironment) {
        merchantEnvironment.setCreatedTime(System.currentTimeMillis() / 1000);
        return merchantEnvironmentMapper.saveMerchantEnvironment(merchantEnvironment) > 0;
    }

    @Override
    public List<MerchantEnvironment> getMerchantEnvironmentList(MerchantEnvironment merchantEnvironment) {

        return merchantEnvironmentMapper.getMerchantEnvironmentList(merchantEnvironment);
    }

    @Override
    public boolean updateMerchantEnvironment(MerchantEnvironment merchantEnvironment) {
        merchantEnvironment.setUpdatedTime(System.currentTimeMillis() / 1000);
        return merchantEnvironmentMapper.updateMerchantEnvironment(merchantEnvironment) > 0;
    }

    @Override
    public boolean deleteMerchantEnvironment(MerchantEnvironment merchantEnvironment) {
        merchantEnvironment.setDeleted(1);
        merchantEnvironment.setDeletedTime(System.currentTimeMillis() / 1000);
        return merchantEnvironmentMapper.updateMerchantEnvironment(merchantEnvironment) > 0;
    }


}
